# -*- coding: utf-8 -*-
# @Time    : 2021/3/12 11:12
# @Author  : xiao
from basic.device.Android import Android


class H5View(Android):


    @classmethod
    def view(cls,text):
        if cls.poco(text).exists():
           return cls.poco(text)
        else:
            return cls.poco(text=text)

    @classmethod
    def views(cls, text):
        if cls.poco(nameMatches=text).exists():
            return cls.poco(nameMatches=text)
        else:
            return cls.poco(textMatches=text)

    @classmethod
    def viewExists(cls, text):
        if cls.poco(text).exists():
            return True
        else:
            if cls.poco(text=text).exists():
                return True
            else: return False

    @classmethod
    def getViewName(cls,view):
        text=view.get_name()
        if text!="":
            return text
        else:
            return view.get_text()
